<?php
declare (strict_types = 1);

namespace app\api\controller;
use app\model\BookChaptersModel;
use app\model\BookContentsModel;
use app\model\BookShelvesModel;
use app\model\BooksModel;
use app\model\RedisModel;
use app\model\SeventyTwoDivisionsModel;
use app\model\UserModel;
use app\model\UserReadingRecordsModel;
use app\model\UserSearchHistoryModel;
use think\App;
use think\facade\Db;

class SeventyTwoDivisions extends Base {

    private $model;

    public $cacheKey="seventy:two:divisions:id:";
    private $req;

    public function __construct(App $app)
    {
        parent::__construct($app);

        $this->req = request()->param();

        $this->model = new SeventyTwoDivisionsModel();

    }



    public function getSeventyTwoDivisions(){

        $date = !empty($this->req["date"]) ? $this->req["date"] : date('Y-m-d');

        return $this->succ($this->model->getDateInfo($date) ?? []);
    }




    public function delCache($id)
    {
        $redisModel = new RedisModel();

        return $redisModel->delete($this->cacheKey.$id);
    }


    public function delAllCache()
    {
        $redisModel = new RedisModel();

        return $redisModel->deleteAll($this->cacheKey);
    }
}
